from mongoengine import *
from django.db.models.functions import datetime
# Create your models here.
# 链接Mongo数据库
# connect('Spider', host='192.168.1.173', port=27017)
connect('record', host='127.0.0.1', port=27017)


class NewsSpider(Document):
    _id = ObjectIdField()
    title = StringField()  # 标题
    date = StringField()  # 日期
    sourceName = StringField()  # 引用源名
    sourceUrl = StringField()  # 引用源链接
    article = StringField()  # 正文
    insertDate = DateTimeField(default=datetime.datetime.now)  # 插入数据库时间
    status = StringField()  # 是否含有敏感词汇 1为有 2 为
    spider_source = StringField()  # 爬虫源
    examine = StringField()  # 是否过滤，未过滤：suspend；已过滤：pass

    meta = {'collection': 'News'}  # 指明连接数据库的哪张表
